/**
 * 统一Toast提示封装
 */

// 成功提示
export const showSuccess = (title, duration = 1500) => {
	uni.showToast({
		title,
		icon: 'success',
		duration
	});
};

// 错误提示
export const showError = (title, duration = 1500) => {
	uni.showToast({
		title,
		icon: 'none',
		duration,
		image: '/static/images/error.png' // 可选：自定义错误图标
	});
};

// 普通提示
export const showToast = (title, duration = 1500) => {
	uni.showToast({
		title,
		icon: 'none',
		duration
	});
};

// 加载中提示
export const showLoading = (title = '加载中...') => {
	uni.showLoading({
		title,
		mask: true
	});
};

// 隐藏提示
export const hideToast = () => {
	uni.hideToast();
};

export const hideLoading = () => {
	uni.hideLoading();
};

export default {
	success: showSuccess,
	error: showError,
	toast: showToast,
	loading: showLoading,
	hideToast,
	hideLoading
};